package com.project.webapp.action.backend.basic;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.project.dao.bean.Menu;
import com.project.service.backend.basic.IPreSchoolManageService;
import com.project.webapp.action.BaseAction;

public class PreSchoolManageAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IPreSchoolManageService preSchoolManageService;
	private String operateResult;

	// 婴幼儿教育list
	private List<Menu> childList;
	// 文艺/体育list
	private List<Menu> artList;
	// 外语list
	private List<Menu> languageList;
	// 被选中的id
	private String chkedMenuId;

	@Override
	public String execute() {
		this.setOperateResult("");
		this.init();
		return SUCCESS;
	}

	public String save() {
		try {
			preSchoolManageService.save(chkedMenuId);
			operateResult = "suc";
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			operateResult = "fail";
		}
		this.init();
		return SUCCESS;
	}

	public void init() {
		// TODO Auto-generated method stub
		try {
			/**
			 * 获取婴幼儿教育0101010000的记录
			 */
			// 获取四级菜单
			childList = preSchoolManageService
					.getDescendantMenuByAncestorCodeAndSeq("0101010000", "4");

			/**
			 * 获文艺/体育0101020000的记录
			 */
			// 获取四级菜单
			artList = preSchoolManageService
					.getDescendantMenuByAncestorCodeAndSeq("0101020000", "4");

			/**
			 * 获取外语0101030000的记录
			 */
			// 获取四级菜单
			languageList = preSchoolManageService
					.getDescendantMenuByAncestorCodeAndSeq("0101030000", "4");
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}


	public List<Menu> getArtList() {
		return artList;
	}

	public void setArtList(List<Menu> artList) {
		this.artList = artList;
	}

	public List<Menu> getChildList() {
		return childList;
	}

	public void setChildList(List<Menu> childList) {
		this.childList = childList;
	}

	public List<Menu> getLanguageList() {
		return languageList;
	}

	public void setLanguageList(List<Menu> languageList) {
		this.languageList = languageList;
	}

	public void setPreSchoolManageService(
			IPreSchoolManageService preSchoolManageService) {
		this.preSchoolManageService = preSchoolManageService;
	}

	public String getOperateResult() {
		return operateResult;
	}

	public void setOperateResult(String operateResult) {
		this.operateResult = operateResult;
	}

	public String getChkedMenuId() {
		return chkedMenuId;
	}

	public void setChkedMenuId(String chkedMenuId) {
		this.chkedMenuId = chkedMenuId;
	}

}
